import ProfileQuery from './queries/Viewer';
import mutations from './mutations';

import {
  GraphQLSchema as Schema,
  GraphQLObjectType as ObjectType,
} from 'graphql';

import relayNode from './relay';

const RelayNodeQuery = { node: relayNode.nodeField };

const schema = new Schema({
  query: new ObjectType({
    name: 'Query',
    fields: [RelayNodeQuery, ProfileQuery].reduce((holder, queries) => Object.assign({}, holder, queries), {}),
  }),
  mutation: new ObjectType({
    name: 'Mutation',
    fields: mutations.reduce((holder, mutations) => Object.assign({}, holder, mutations), {}),
  }),
});

export default schema;

